package com.jinke.api.modules.third.carryship.model.response;

import com.jinke.api.common.api.CommonResult;
import lombok.Data;

import java.util.List;

@Data
public class CreateOrderResponse {
    private Integer responseCode;
    private String msg;
    private GetPriceResponse.ResponseDate2 responseDate;

    @Data
    public class ResponseDate2 {
        private GetPriceResponse.ResponseDateData data;

    }
    @Data
    public class ResponseDateData {
        private List<GetPriceResponse.ResponseDateData.ResponseCodeHelp> responseCodeHelpList;

        @Data
        public class ResponseCodeHelp {
            private String responseCode;
            private String msg;
            private GetPriceResponse.ResponseDate1 responseDate;
        }
    }

    @Data
    public class ResponseDate1 {
        private GetPriceResponse.GoBack goBack;

    }
    @Data
    public class GoBack {
        private ShipData shipData;

    }

    @Data
    public class ShipData {
        private String amount;
        private String imageType;
        private String packageList;
        private String trackingNumber;
        private String lableType;

    }
    public CommonResult toCommonResult() {
        // 判断是否成功
        CommonResult commonResult = CommonResult.success();
        if (!isSuccess()) {
            commonResult = CommonResult.failed(msg);
        }
        return commonResult;
    }

    public boolean isSuccess() {
        boolean result = true;
        // 判断是否成功
        if (responseCode != 200020002) {
            result = false;
        }
        return result;
    }


}
